@echo off
cls

if exist build      ( rmdir /s /q build      )
if exist product    ( rmdir /s /q product    )
if exist 1build.log ( del   /s /q 1build.log )

for %%a in (.) do set NAME_PRODUCT=%%~na

call :findroot

if exist %ROOT%\build ( 
    for /D %%a in ( %ROOT%\build\*-%NAME_PRODUCT%  ) do rmdir /s /q %%a
)

exit

















rem ------------------------------------------------------

:success
    set ROOT=%CD%
    cd %~dp0
    exit /b

:failed
    echo  ERROR: WORKSPACE DIRECTORY NOT FOUND
    exit

:findroot
    set DRIVE=%CD:~0,3%

:loop
    if exist %CD%\service (
        goto :success
    ) ELSE (
        if "%DRIVE%" == "%CD%" goto :failed
        cd ..
        goto :loop
    )
    exit /b

rem ------------------------------------------------------








       

